# the next line sets up include and link directories and defines some variables that we will use.
# you can modify the behavior by setting some variables, e.g.
#   set(QT_USE_OPENGL TRUE)
# -> this will cause cmake to include and link against the OpenGL module

include(${QT_USE_FILE})
include("PCHSupport")

include_directories( ${EXPE_CORE_INCLUDES} )
# include_directories( ${EXPE_GPU_INCLUDES} )
include_directories( ${EXPE_GEOMETRY_INCLUDES} )

# the variable "qtproject_SRCS" contains all .cpp files of this project
set(ExpeGeometry_src

    ExpeGeometryObject.cpp
    ExpeGeometryOperator.cpp
    
    PointSet/ExpePointSet.cpp
    PointSet/ExpePointSetIO.cpp
    PointSet/ExpeRadiusEvaluatorFromDensity.cpp
    
    Mesh/ExpeMesh.cpp
    Mesh/ExpeHalfedgeConnectivity.cpp
    Mesh/ExpeMeshIO.cpp
    Mesh/ExpeMeshNormalEvaluator.cpp
    Mesh/ExpeBasicMesh2PointSet.cpp
    ExpeGeometryAutoReshape.cpp
    
    ExpeWeightingFunction.cpp
    Neighborhood/ExpeQueryDataStructure.cpp
    Neighborhood/ExpeQueryGrid.cpp
    Neighborhood/ExpeKdTree.cpp
    Neighborhood/ExpeNeighborhood.cpp
    Neighborhood/ExpeEuclideanNeighborhood.cpp
    Neighborhood/ExpeBallNeighborhood.cpp
    
    ExpeImplicitSurface.cpp
    Fitter/ExpeAlgebraicSphere.cpp
    Fitter/ExpeNormalConstrainedSphereFitter.cpp
    MlsSurfaces/ExpeMlsSurface.cpp
    MlsSurfaces/ExpeLocalMlsApproximationSurface.cpp
    MlsSurfaces/ExpeSphericalMlsSurface.cpp
    MlsSurfaces/ExpeNormalConstrainedSphericalMlsSurface.cpp
    MlsSurfaces/ExpeSimplePSS.cpp
    
    ExpeMarchingCube.cpp
)

if (GSL_FOUND)
    set (ExpeGeometry_src ${ExpeGeometry_src}
        Fitter/ExpeEigenSphereFitter.cpp
    )
endif (GSL_FOUND)

# tell cmake to create .moc files for all files in the variable qtproject_SRCS that require such a file.
# note: this assumes that you use #include "header.moc" in your files
qt4_automoc( ${ExpeGeometry_src} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# create an executable file named "qtproject" from the source files in the variable "qtproject_SRCS".
add_library(ExpeGeometry SHARED ${ExpeGeometry_src})
ADD_PRECOMPILED_HEADER(ExpeGeometry ExpeGeometryPCH.h true)

# link the "qtproject" target against the Qt libraries. which libraries exactly, is defined by the "include(${QT_USE_FILE})" line above, which sets up this variable.
target_link_libraries(ExpeGeometry ${QT_LIBRARIES} ExpeCore)

if (EXPE_BUILD_TESTS)
    add_subdirectory(Tests)
endif (EXPE_BUILD_TESTS)
